package com.imau.dao;

import com.imau.bean.Book;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface BookDao {

    @Insert("insert into tbl_book (type,name,description) values(#{type},#{name},#{description})")
    int addBook(Book book);

    @Delete("delete from tbl_book where id = #{id}")
    int deleteBookById(@Param("id") Integer id);

    @Update("update tbl_book set type = #{type}, name = #{name}, description = #{description} where id = #{id}")
    int updateBook(Book book);

    @Select("select * from tbl_book where  id = #{id}")
    Book queryBookById(@Param("id") int id);
    @Select("select * from tbl_book ")
    List<Book> queryAllBook();


    List<Book> queryAllBookByBookName(@Param("bookName") String bookName);
}
